<?php
$rows = array();
foreach ($categorys as $k => $category) {
    $i = $k % 2;
    $colums[$i][$category->id]['title'] = $category->title;
    foreach ($faqs as $faq) {
        if ($faq->faq_category_id == $category->id) {
            $colums[$i][$category->id]['faqs'][] = $faq;
        }
    }
}
?>


<div class="container">
    <div id="main">
        <div class="faq">
            <h2 class="page-header">Вопросы и ответы</h2>
            <div class="content">

                <div class="row">
                    <?php foreach ($colums as $colum) { ?>
                        <div class="span6">
                            <?php foreach ($colum as $z => $category) { ?>

                                <h2><?php echo $category['title']; ?></h2>

                                <div class="accordion" id="faq<?= $z; ?>">
                                    
                                    <?php foreach ($category['faqs'] as $faq) { ?>
                                        <div class="accordion-group">
                                            <div class="accordion-heading">
                                                <a class="accordion-toggle" data-toggle="collapse" data-parent="#faq<?= $faq->id; ?>" href="#collapse<?= $faq->id; ?>">
                                                    <span class="sign"></span> <?= $faq->question;?>
                                                </a>
                                            </div><!-- /.accordion-heading -->

                                            <div id="collapse<?= $faq->id; ?>" class="accordion-body collapse">
                                                <div class="accordion-inner">
                                                    <?= $faq->answer;?>
                                                </div><!-- /.accordion-inner -->
                                            </div><!-- /.accordion-body -->
                                        </div><!-- /.accordion-group -->
                                    <?php } ?>
                                </div>
                            <?php } ?>
                        </div><!-- /.span6 -->
                    <?php } ?>

                </div><!-- /.row -->
            </div><!-- /.content -->
        </div><!-- /.faq -->
        <?php $this->widget('application.widgets.front.ArticleWidget', array()); ?>
        <?php $this->widget('application.widgets.front.RegionalCentersWidget', array()); ?>
    </div>
</div>